package com.jenkins.test.cron;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * @version V1.0.0
 * @ClassName: {@link ScheduleConfiguration}
 * @Description: 定时器任务配置
 * @author: Lanzhou
 * @date: 2021/6/28 15:14
 * @Copyright:2020 All rights reserved.
 */
@Configuration
public class ScheduleConfiguration {

    @Bean
    public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
        scheduler.setPoolSize(20);
        scheduler.setThreadNamePrefix("ScheduleTask-");
        scheduler.setWaitForTasksToCompleteOnShutdown(true);
        scheduler.setAwaitTerminationSeconds(60);
        return scheduler;
    }


}
